package com.imooc.distributedemo.resume;

import lombok.Synchronized;

import java.math.BigDecimal;

public class BaseDemo {
    public synchronized void getData(String st1){
        double dbl = Math.round(-1.5);
        System.out.println(dbl);
        System.out.println("===============");
    }

    public static void main(String[] args) {
        double dbl = Math.round(-1.5);

        System.out.println(dbl);
        System.out.println("==bigdecimal==");
        try {
            bigDecimalMethod();
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public void test1(){
        Foo<Integer> f1;
        Foo<String> f2;
    }

    private static void bigDecimalMethod() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        BigDecimal b1 = new BigDecimal(1.0);
        BigDecimal b2 = new BigDecimal(1);
        boolean boolCmp = b1.equals(b2);
        int intCmp = b1.compareTo(b2);
        System.out.println(boolCmp);
        System.out.println(intCmp);

        BigDecimal floatVal = new BigDecimal(0.1F);
        BigDecimal dc1 = new BigDecimal("0.1");
        BigDecimal dc2 = BigDecimal.valueOf(0.1);
        System.out.println(floatVal);
        System.out.println(dc1);
        System.out.println(dc2);
        boolean bool1 = dc1.equals(dc2);
        int int2 = dc1.compareTo(dc2);
        System.out.println("=============");

        // 如何创建对象
        User user1 = new User();
        User user2 = (User)Class.forName("com.imooc.distributedemo.resume.User").newInstance();
        User user3 = User.class.newInstance();

    }
}
